{config_load file='site.conf' section='entry_edit'}
{include file='header.tpl'}
{literal}
 <SCRIPT LANGUAGE="JavaScript">
 <!--	
  $().ready(function() {		   
		$("#entryForm").validate({
			rules: {
				entry_title: "required",
				entry_url: {
					required: true,
					url: true
				}
			},
			messages: {
				entry_title: "エントリのタイトルは必須です",
				entry_url: {
					required: "エントリのURLは必須です",
					url: "正しくURLを入力してください。"
				}
			}
		});
	
	});
 		   
	function doBack()
	{
		location.href="entry_index.php?title="+$("#title").attr("value");
	}
 //-->
 </SCRIPT>
{/literal}


<div id="bg">
	<div id="page">
		<div id="content">
		{if $msg ne ""}<div class="errorMsg">{$msg}</div>{/if}
			<div class="post">
				<h2 class="title">エントリ編集</h2>
				<div class="entry">
				<form id="entryForm" name="entryForm" action="{$SCRIPT_NAME}" method="post" >
				<input type="hidden" name="action" id="action" value="update"/>
				<input type="hidden" name="entry_id" id="entry_id" value="{$formvars.entry_id|escape}"/>
				<input type="hidden" name="title" id="title" value="{$formvars.title|escape}" />
				<table width="800" id="tb_form">
				  <tr>
				    <th width="150" >エントリID</th>
				    <td width="650" >{$rslt.entry_id|escape}</td>
				  </tr>
				  <tr>
				    <th>タイトル<span class="required">(必須)</span></th>
				    <td><input name="entry_title" type="text" id="entry_title" size="50" maxlength="200" value="{$rslt.title|escape}"></td>
				  </tr>
				  <tr>
				    <th>URL<span class="required">(必須)</span></th>
				    <td><input name="entry_url" type="text" id="entry_url" size="50" maxlength="200" value="{$rslt.entry_url|escape}">
				      <a href="{$rslt.entry_url|escape}" target="_blank">外部リンク</a></td>
				  </tr>
				  <tr>
				    <th>コメント </th>
				    <td><textarea name="comment" cols="60" rows="5">{$rslt.comment|escape}</textarea></td>
				  </tr>
				   <tr>
				    <th>description</th>
				    <td>
					<textarea name="description" cols="60" rows="5">{$rslt.description|escape}</textarea>
					</td>
				  </tr>
				  <tr>
				    <th>ステータス</th>
				    <td>
					{html_options name=open_flag options=$statusList selected=$rslt.open_flag}
					</td>
				  </tr>
				  <tr>
				    <th>投稿日時</th>
				    <td>
					<input name="up_date" type="text" id="up_date" size="50" maxlength="200" value="{$rslt.up_date|escape}">
					</td>
				  </tr>
				  <tr>
				    <th>&nbsp;</th>
				    <td>       
					<input type="submit" value="更新" class="submitButton">
				    <input type="reset"  value="リセット" class="submitButton">
					<input type="button"  value="戻る" OnClick="doBack();" class="submitButton"></td>
				  </tr>
				</table>
				<br>
				</form>				
			 	 </div>
			</div>
			
			<div class="post">
				<h2 class="title">関連タグ編集</h2>
				<div class="entry">
				<table width="800" id="tb_form">
					<form id="tagForm" name="tagForm" action="{$SCRIPT_NAME}" method="post" >
					<input type="hidden" name="action" id="action" value="updateTag"/>
					<input type="hidden" name="entry_id" id="entry_id" value="{$rslt.entry_id|escape}"/>
					<tr>
						<th width="150" >エントリID</th>
						<td width="650" >{$rslt.entry_id|escape}</td>
					</tr>
					{foreach from=$entryTabList key=k item=row}
					<tr>
						<th>ジャンルタグ_{$k}</th>
						<td>{html_options name=tag_id[] options=$tagList selected=$row.tag_id}[<a href="entry_edit.php?action=delTag&tag_id={$row.tag_id}&entry_id={$row.entry_id}">削除</a>]</td>
					</tr>
					{/foreach}
					{if $tagNum > 0}
					<tr>
						<th>&nbsp;</th>
						<td>  
							<input type="submit" value="更新" class="submitButton">
							<input type="reset"  value="リセット" class="submitButton">
						</td>
					</tr>
					{/if}
					</form>
					<if 
					<form id="tagForm" name="tagForm" action="{$SCRIPT_NAME}" method="post" >
					<input type="hidden" name="action" id="action" value="insertTag"/>
					<input type="hidden" name="entry_id" id="entry_id" value="{$rslt.entry_id|escape}"/>
					<tr>
						<th>新規追加</th>
						<td>
							{html_options name=tag_id options=$tagList}
							<input type="submit" value="追加" class="submitButton">
						</td>
					</tr>
				</table>
				</form>
				</div>
			</div>
		</div>
		<!-- end #content -->
		<!-- end #sidebar -->
		<div style="clear: both; height: 20px;">&nbsp;</div>
	</div>
	<!-- end #page -->
</div>
{include file='footer.tpl'}


</body>
</html>
